package com.zoro.barn.business.service.sqldocument.business.sql.errors;

import com.zoro.barn.commons.foundation.exceptions.PayloadBusinessException;

import java.util.HashMap;
import java.util.Map;

/**
 * @author zhaoxingwu
 */
public class MoveSqlBusyException extends PayloadBusinessException {
    public static final String CODE = "MOVE_SQL_BUSY";
    public static final String MESSAGE = "Other user is doing this business,try later please!";

    private MoveSqlBusyException(String message, Object data) {
        super(message, CODE, data);
    }

    private MoveSqlBusyException(Object data) {
        super(MESSAGE, CODE, data);
    }

    public static MoveSqlBusyException build(String userAccount, String userName) {
        Map<String, String> data = new HashMap<>();
        data.put("userAccount", userAccount);
        data.put("userName", userName);
        return new MoveSqlBusyException(data);
    }
}
